]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
history: Fix bogus return value
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 13 Jun 2017 02:56:34 +0000 (04:56 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 13 Jul 2017 15:23:54 +0000 (17:23 +0200)
We only use lastItem() to reset the history index to the end, so
nobody noticed the utter nonsense in the return value until gjs
started to warn about it. As we don't actually use the value
anywhere, we could just remove it, but the function name implies
that an item is returned, so fix it to behave as advertised.

https://bugzilla.gnome.org/show_bug.cgi?id=781471

js/misc/history.js

index b56d8306462c3f29beed598b81d85c1cc0243d66..44d21b7d6cc2e81c369b1fde1adc9ec1b37a16f2 100644 (file)
@@ -69,7 +69,7 @@ const HistoryManager = new Lang.Class({
             this._indexChanged();
         }
 
-        return this._historyIndex[this._history.length];
+        return this._historyIndex ? this._history[this._historyIndex -1] : null;
     },
 
     addItem: function(input) {